package library.http;

import java.lang.annotation.Annotation;

import library.http.annotations.DELETE;
import library.http.annotations.GET;
import library.http.annotations.HEAD;
import library.http.annotations.PATCH;
import library.http.annotations.POST;
import library.http.annotations.PUT;


public enum HttpMethod {
    HEAD(),
    GET(),
    POST(),
    PUT(),
    PATCH(),
    DELETE();

    public static HttpMethod valueOf(Annotation annotation) {
        if (annotation instanceof HEAD) {
            return HEAD;
        } else if (annotation instanceof GET) {
            return GET;
        } else if (annotation instanceof POST) {
            return POST;
        } else if (annotation instanceof PUT) {
            return PUT;
        } else if (annotation instanceof DELETE) {
            return DELETE;
        } else if (annotation instanceof PATCH) {
            return PATCH;
        }
        return null;
    }
}
